package com.yy.tankgame;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

/**
 * 
 *@author Yun
 *添加血块类
 *@date 2014-9-7 上午12:01:00
 *@version	0.1
 */

/**
 * @author Yun
 *
 */
public class Blood {
	int x,y,w,h;
	TankClient tc;
	private int [][] pos = {
			{200,200},{200,300},{200,400},{300,400},{400,400},{300,300},{400,200}
	};
	private int step;
	private boolean Live = true;
	
	public Blood() {
		x = pos[0][0];
		y = pos[0][1];
		w = h = 15;
	}
	public void draw(Graphics g){	
		if(!Live) return;
		Color c = g.getColor();
		g.setColor(Color.magenta);
		
		g.fillRect(x, y, w, h);
		g.setColor(c);
		
		move();
	}
	/**
	 * 
	 */
	private void move() {
		
		step ++;
		
		if(step == pos.length){
			step = 0;
		}
		x = pos[step][0];
		y = pos[step][1];
		
	}
	
	public Rectangle getRect(){
		return new Rectangle(x, y, w, h);
	}
	/**
	 * @param b
	 */
	public void setLive(boolean b) {
		
		Live = b;
	}
	/**
	 * @return
	 */
	public boolean getLive() {
		
		return Live;
	}
}
